A well-formed XML document is comprised of three parts:
The prolog consists of of two basic components, also optional: the XML declaration and document type declaration. The document type declaration identifies the version of the XML specification to which the document conforms. Although optional, it is recommended that you always include the XML declaration in your document. It should appear at the beginning of the document. The complete syntax of the XML declaration is given below. (NOTE: the version attribute is required and must be in lowercase):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
An XML declaration can also contain an optional encoding declaration and/or an optional standalone document declaration. The encoding declaration identifies the character encoding scheme. Different encoding schemes map to different character formats or languages. UTF-8, the default scheme, includes representations for most English language characters (NOTE: it is not necessary to declare encoding="UTF-8", since it is the default).
The standalone document declaration identifies whether any markup declarations exist that are external to the document. This declaration can have the value yes or no (NOTE: if the document is standalone, this attribute is often omitted).
The document type declaration contains markup code indicating the grammatical rules, or Document Type Definition (DTD), for a particular class of documents. It can also point to an external file that contains all or part of the DTD. The document type declaration must appear after the XML declaration and before the document element. The code below adds a document type declaration to an XML declaration:
<?xml version="1.0"><!DOCTYPE Wildflowers SYSTEM "Wldflr.dtd">
This code declares the document type as Wildflowers and tells the XML processor that the document should follow the rules in the external DTD file Wldflr.dtd.
Copyright 2000 Extensibility, Inc.
Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516